## 这是一个筛选模型的程序
## 通过model里面的文件名与pictrue中的文件名对比pic中没有的文件 来剔除model中多余的


import os

MODEL_PATH = 'D:\model_100\model_2'
PIC_PATH = 'D:\model_100\picture\dat'
del_num = 0
for root, dirs, files in os.walk(MODEL_PATH):

    for file in files:
        if file[-3:] == 'dat':
            continue
        if os.path.exists(os.path.join(PIC_PATH, file[:-4]) + 'png'):
            pass
        else:
            print('delete', file, file[:-4] + 'dat')
            os.remove(os.path.join(MODEL_PATH, file))
            os.remove(os.path.join(MODEL_PATH, file[:-4] + 'dat'))
            del_num += 1
print('tatal delete', del_num)
